﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Ivy.UserRegistration.IBusinessLogic;
using Ivy.UserRegistration.BusinessLogic;
using Ivy.UserRegistration.Entity;

using Ivy.SiteAdmin.IBusinessLogic;
using Ivy.SiteAdmin.BusinessLogic;
using Ivy.SiteAdmin.Entity;

using DasIdeen.ViewEntity;

namespace DasIdeen
{
    public partial class SiteMaster : System.Web.UI.MasterPage
    {
        #region  Variable & constant
        #endregion  Variable & constant

        #region Constructor & Destructor
        #endregion Constructor & Destructor

        #region Properties
        #endregion Properties

        #region Public Methods
        #endregion Public Methods

        #region Events
        protected void Page_Load(object sender, EventArgs e)
        {
            //InitializeScreen();
        }

        //protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
        //{
        //    SubscriptionMaster lSubscriptionMaster = new SubscriptionMaster();
        //    SiteAdminBus lSiteAdminBus = new SiteAdminBus();
        //    TranslateEntityToUIControls(lSubscriptionMaster);
        //    lSiteAdminBus.RegisterNewSubscription(lSubscriptionMaster);
        //    ClearScreen();

        //}
        //protected void ImageButton1_Click1(object sender, EventArgs e)
        //{
        //    SubscriptionMaster lSubscriptionMaster = new SubscriptionMaster();
        //    SiteAdminBus lSiteAdminBus = new SiteAdminBus();
        //    TranslateEntityToUIControls(lSubscriptionMaster);
        //    lSiteAdminBus.RegisterNewSubscription(lSubscriptionMaster);
        //    ClearScreen();
        //}

        
        protected void imgbtnSubscription_Click(object sender, EventArgs e)
        {
            if (this.txtUserMailId.Text != "")
            {
                SubscriptionMaster lSubscriptionMaster = new SubscriptionMaster();
                SiteAdminBus lSiteAdminBus = new SiteAdminBus();
                TranslateEntityToUIControls(lSubscriptionMaster);
                lSiteAdminBus.RegisterNewSubscription(lSubscriptionMaster);
                ClearScreen();
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "{some text for type}", "alert('Thank you for subscribing newslater'); ", true);
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "{some text for type}", "alert('Please enter a vaild email id'); ", true);
            }
        }

        #endregion Events

        #region Private Methods
        private void CheckUserAutherization()
        {
        }

        private void ClearScreen()
        {
            this.txtUserMailId.Text = string.Empty;
        }

        private void InitializeScreen()
        {
            ClearScreen();
            FillLoadLookUpData();
        }

        private void FillLoadLookUpData()
        {
        }

        private void TranslateEntityToUIControls(SubscriptionMaster pSubscriptionMaster)
        {
            pSubscriptionMaster.SubscribItemDescription = "General";
            pSubscriptionMaster.SubscribUserMailID = this.txtUserMailId.Text;

            pSubscriptionMaster.Sys_CreatedByID = "1";
        }

        private void TranslateUIControlsToEntity()
        {
        }

        #endregion Private Methods  
    }
}
